package com.futureCloudMOM.controller.core.web.produce;

import com.futureCloudMOM.common.annotation.Log;
import com.futureCloudMOM.common.core.domain.AjaxResult;
import com.futureCloudMOM.controller.core.controller.BaseApiController;
import com.futureCloudMOM.core.domain.ProduceReport;
import com.futureCloudMOM.core.service.ProduceReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.NoSuchElementException;

/**
 * 文件名 ProduceReportController
 *
 * @since 2023/6/6 16:05
 */
@Api(tags = "报工")
@RestController
@RequestMapping("produce/report")
public class ProduceReportController extends BaseApiController<ProduceReport, ProduceReport, ProduceReportService> {

    public ProduceReportController(ProduceReportService service) {
        super(service);
    }


    @Log(title = "报工")
    @ApiOperation("报工")
    @PostMapping("/create")
    public AjaxResult create(@RequestBody ProduceReport produceReport){
        service.create(produceReport);
        return success();
    }

    @Log(title = "报工审核")
    @ApiOperation("报工审核")
    @GetMapping("/reportCheck/{id}")
    public AjaxResult reportCheck(@PathVariable("id") Long id){
        service.reportCheck(id);
        return success();
    }

    @Log(title = "报工反审核")
    @ApiOperation("报工反审核")
    @GetMapping("/reverseCheck/{id}")
    public AjaxResult reverseCheck(@PathVariable("id") Long id){
        service.reverseCheck(id);
        return success();
    }

    @Log(title = "报工作废")
    @ApiOperation("报工作废")
    @GetMapping("/cancellation/{id}")
    public AjaxResult cancellation(@PathVariable("id") Long id){
        service.cancellation(id);
        return success();
    }

    @Log(title = "报工变更")
    @ApiOperation("报工变更")
    @PostMapping("/alteration")
    public AjaxResult alteration(@RequestBody ProduceReport produceReport){
        service.alteration(produceReport);
        return success();
    }

}
